﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<KLS.PPDS.Web.Models.PublicationSaveViewModel>" %>
<%@ Import Namespace="KLS.PPDS.Resources" %>
<%@ Import Namespace="KLS.PPDS.Utility.Html" %>
<%@ Import Namespace="KLS.PPDS.Utility" %>



<%using (Html.BeginForm("Save", "Publication", FormMethod.Post, new { @Id = "frm-publication", @class = "submitform", @onkeypress = "applyEnter(event);" }))
  {%>
  <%:Html.HiddenFor(c=>c.OldComapnyId) %>

<fieldset>
    <legend><%:CommonString.PublicationSettings%></legend>
    
    <table>
        <tr>
            <td>
                <%:CommonString.Id %>
            </td>
            <td>
                <input disabled="disabled" type="text" value="<%=Model.Id==0?"":Model.Id.ToString() %>" />
            </td>
        </tr>
        <tr>
            <td>
                <%:CommonString.Name %>
            </td>
            <td>
                <% var pubName = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required", @maxlength = "100" }: (object)new { @disabled = "disabled" };%>
                <%:Html.TextBoxFor(c => c.PublicationName, pubName)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:CommonString.Number %>
            </td>
            <td>
                <% var pubNumber = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required", @maxlength = "50" }: (object)new { @disabled = "disabled" };%>
                <%:Html.TextBoxFor(c => c.PublicationNumber, pubNumber)%>
            </td>
        </tr>
        <%if (CommonSession.IsUserSuperAdminOrGraphic || CommonSession.IsUserSuperAdmin)
        {%>
            <tr>
                <td>
                    <%:CommonString.Company%>
                </td>
                <td>
                    <% var company = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required" }: (object)new { @disabled = "disabled" };%>
                     <%:Html.DropDownListFor(c => c.CompanyId, ViewData["companies"] as SelectList, CommonMessage.SelectCompany, company)%>
                </td>
            </tr>

        <%} %>

        <tr>
            <td>
                <%:CommonString.Month %>
            </td>
            <td>
                <% var month = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required" }: (object)new { @disabled = "disabled" };%>
                <%:Html.DropDownListFor(c => c.Month, ViewData["months"] as SelectList,month)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:CommonString.Year %>
            </td>
            <td>
                <% var year = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required" }: (object)new { @disabled = "disabled" };%>
                <%:Html.DropDownListFor(c => c.Year, ViewData["years"] as SelectList, year)%>
            </td>
        </tr>
        <tr>
            <td>
                <%:CommonString.Pages %>
            </td>
            <td>
                <% var pages = Model.IsTextDisabled.Equals(false) ? (object)new { @class = "required digits", @maxlength = "3", @min = "1", @max = WebConfig.PublicationMaxPageCount } : (object)new { @disabled = "disabled" };%>
                <%:Html.TextBoxFor(c => c.Pages, pages)%>
            </td>
        </tr>
    </table>
    <br />
    <table class="buttons-area">
        <tr>
            <td>
               
                

                  <%if (Model.Id > 0)
{%>
                    
                        <%:Html.DivActionLink(CommonString.Storyboard, "",new{@class = "storyboard-button",@onclick =string.Format("OpenStoryBoard('/Storyboard/Index?publicationId={0}')",Model.Id)})%>
                    

                    
                    <%
                    if (CommonSession.IsUserSuperAdmin || CommonSession.IsUserEditor)
                    {%>
                                        
                        <%:Html.DivActionLink(CommonString.Delete, "",new{@class = "delete-button",@href =string.Format("Publication/Delete?PublicationId={0}", Model.Id),@message = CommonMessage.DeletePublicationConfirmation})%>
                    
              



                <%
                }
}%>
                
                <%
                  
                if ( CommonSession.IsUserSuperAdmin||CommonSession.IsUserEditor)
                {%>

               
                    <%:Html.DivActionLink(CommonString.Save, "", new { @class = "AjaxSubmitEast save-button" })%>
                
             <%} %>

            
            </td>
        </tr>
    </table>
</fieldset>
    <%: Html.HiddenFor(model => model.CreatedDate) %>
    <%: Html.HiddenFor(model => model.CreatedBy)%>
    <%: Html.HiddenFor(model => model.UpdatedBy)%>
    <%: Html.HiddenFor(model => model.UpdatedDate)%>
    <%: Html.HiddenFor(model => model.IsDeleted)%>
    <%:Html.HiddenFor(c => c.Id)%>

    
    
    <%if (CommonSession.IsUserEditor)
    {%>
        <%:Html.HiddenFor(c => c.CompanyId)%>
    <%} %>


<% } %>

